<?php
echo $this->navegacion($this->nav);

$domConfig = Zend_Registry::get('domConfig');
$perfil = App_Perfil::getInstance();
$perfil->cargar("ADMIN_CONEXION");
if ($perfil->crear()){
?>
<BR>
<div align="right" class="buttons">
  <a class="btn btn-primary" href="<?php echo $this->baseUrl("/conexionesbd/index/crearconexionbd");?>">
  <span class="glyphicon glyphicon-plus-sign"></span> Crear Conexi&oacute;n</a>
</div>

<?php }
if(count($this->datos)>0):?>
<table id="table_id" align="center" class="display">
  <thead>
    <tr>
      <th width="10%">Codigo</th>
      <th width="20%">Nombre</th>
      <th width="20%">Host</th>
      <th width="20%">Nombre de usuario</th>
      <th width="20%">Base de datos</th>
      <th width="10%">Acciones</th>
    </tr>
  </thead>
  <tbody>
	<?php foreach ($this->datos as $key => $value):?>
    <tr>
      <td><?php echo $value["codconexion"];?></td>
      <td><?php echo "{$value["nombreconexion"]}"?></td>
      <td><?php echo "{$value["hostconexion"]}"?></td>
      <td><?php echo "{$value["username"]}" ;?></td>
      <td><?php echo "{$value["dbname"]}" ;?></td>
      <td>
        <?php
         $params=App_Util_SafeUrl::encriptar(array("codconexion"=>$value["codconexion"]),true);
        $tools = new App_Util_ToolButton();
        $tools->addEdit($this->baseUrl("/conexionesbd/index/crearconexionbd/{$params}"),$perfil->modificar());
         $tools->addDelete($this->baseUrl("/conexionesbd/index/eliminarconexionbd/{$params}"),$perfil->eliminar());
        echo $tools->render();
        ?>
      </td>
    </tr>
  <?php  endforeach;?>
  </tbody>
</table>

<script type="text/javascript">
 $(function() {
	$('#table_id').dataTable({
		"bJQueryUI": true,
		"bAutoWidth": false,
 		"sPaginationType": "full_numbers",
 		"bStateSave": true,
 		"aoColumns": [
 	 		 			{ "sType": "numeric" },
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			{ "bSortable": false, "bSearchable": false }
 	 		 		 ]
 	 		  		
	});
});
</script>
<?php else:?>
<br/>
<?php echo $this->mensajes("No existen registros");?>
<?php endif;?>
